home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / sniper.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  3.5 KB  |  141 lines

  1. //-----
  2. // Sniper.scr
  3. //-----
  4.  
  5. //=============================================================
  6. //=============================================================
  7. SniperMain:
  8. // Note: I rely on this being the only entry point to this script, for initialization purposes.
  9. //println "Entering sniper script"
  10.  
  11.     self.dist_walkbackward = 90
  12.     self.dist_walkforward = 90
  13.     self.backawaypct = 0
  14.     self.shootpct = 100
  15.     self.crouchpct = 50
  16.     self.lastmovement = "none"
  17.         
  18.     // Initialise say manager
  19.     self waitthread anim/SayManager.scr::Init
  20.  
  21.     waitexec anim/default_inithandler.scr
  22.     waitexec anim/smoking.scr::SmokeRemoveCigarette
  23.     
  24.     
  25.     while (1)
  26.     {
  27.  
  28.         waitexec anim/sniper.scr::SniperStandAttack
  29.         
  30.         local.randnum = randomint 100
  31.         if (local.randnum < self.crouchpct)
  32.         {
  33.             waitexec anim/sniper.scr::SniperCrouchAttack
  34.         }
  35.         
  36.         local.randnum = randomint 100
  37.         if (local.randnum < self.backawaypct)
  38.         {
  39.             waitexec anim/attack.scr::AttackCheckBack self.dist_walkbackward
  40.             if (self.collideresult > 0)
  41.             {
  42.                 self.blendtime = 0.5
  43.                 self setmotionanim (self.weapongroup + "_walk_alert_back")
  44.                 self waittill flaggedanimdone
  45.  
  46.                 local.i = randomint(8) + 2
  47.  
  48.                 while (local.i>0)
  49.                 {
  50.                     waitexec anim/sniper.scr::SniperStandAttack
  51.                     local.i = local.i - 1
  52.                 }
  53.                 
  54.                 self.blendtime = 0.5
  55.                 self setmotionanim (self.weapongroup + "_walk_alert_forward")
  56.                 self waittill flaggedanimdone
  57.             }
  58.         }
  59.     }
  60. end
  61.  
  62. //=============================================================
  63. //=============================================================
  64. SniperStandAttack:
  65.     waitexec anim/attack.scr::AttackStandUp
  66.     self setmotionanim (self.weapongroup + "_stand_alert_legs")
  67.     
  68.     local.i = randomint(5) + 2
  69.     while (local.i > 0)
  70.     {
  71.         if (self.lastmovement != "stand_attack")
  72.         {
  73.             self.blendtime = 0.30
  74.             self thread anim/SayManager.scr::SayManager face_aiming 3
  75.             //self setactionanim (self.weapongroup + "_aim") -60 60
  76.             waitexec anim/aim.scr::PlayAimActionAnim
  77.             wait self.blendtime
  78.             self.lastmovement = "stand_attack"
  79.         }
  80.  
  81.         if ((self cansee self.enemy) > 0)
  82.         {
  83.             self.blendtime = 0.10
  84.             self thread anim/SayManager.scr::SayManager face_aiming 3
  85.             //self setactionanim (self.weapongroup + "_shoot") -60 60
  86.             waitexec anim/shoot.scr::PlayShootActionAnim
  87.             self waittill upperanimdone
  88.             waitexec anim/reload.scr::Reload 1 0 0
  89.         }
  90.         else
  91.         {
  92.             waitframe
  93.         }
  94.  
  95.         local.i = local.i - 1
  96.     }
  97.  
  98. end
  99.  
  100. //=============================================================
  101. //=============================================================
  102. SniperCrouchAttack:
  103.     waitexec anim/attack.scr::AttackCheckCrouch
  104.     
  105.     if (self.collideresult > 0)
  106.     {
  107.         waitexec anim/attack.scr::AttackCrouchDown
  108.         self setmotionanim (self.weapongroup + "_crouch_alert")
  109.         
  110.         local.i = randomint(5) + 2
  111.  
  112.         while (local.i > 0)
  113.         {
  114.             if (self.lastmovement != "crouch_attack")
  115.             {
  116.                 self.blendtime = 0.30
  117.                 self thread anim/SayManager.scr::SayManager face_aiming 3
  118.                 //self setactionanim (self.weapongroup + "_aim") -60 60
  119.                 waitexec anim/aim.scr::PlayAimActionAnim
  120.                 wait self.blendtime
  121.                 self.lastmovement = "crouch_attack"
  122.             }
  123.             if ((self cansee self.enemy) > 0)
  124.             {
  125.                 self.blendtime = 0.10
  126.                 self thread anim/SayManager.scr::SayManager face_aiming 3
  127.                 //self setactionanim (self.weapongroup + "_shoot") -60 60
  128.                 waitexec anim/shoot.scr::PlayShootActionAnim
  129.                 self waittill upperanimdone
  130.                 waitexec anim/reload.scr::Reload 1 0 0
  131.             }
  132.             else
  133.             {
  134.                 waitframe
  135.             }
  136.             
  137.             local.i = local.i - 1
  138.         }
  139.     }
  140.  
  141. end